<template>
  <div class="firstdiv">
    <div class="lastdiv">
      <!--页面标题-->
      <div class="left-title">
        <h2>{{pageTitle}}</h2>
      </div>
      <div class="title-line"></div>

      <div class="buttonArr">
        <a href="../../static/测试表.xlsx" rel="external nofollow" download="用户表">
              <el-button size="small" type="success">导入模板下载</el-button>
        </a>
        <el-button @click="daoru()">人员导入</el-button>
      </div>
    <div class="jvli" >
      <div>
        <fieldset style="border: 1px solid black; overflow:auto;height: 250px" >
          <legend>Log</legend>
          <div v-for="o in 4" :key="o" class="text item" >
            {{'成功列表内容 ' + o }}
          </div>
          <!--</el-card>-->
        </fieldset>
        <br>
        <fieldset style="border: 1px solid black;overflow:auto;height: 250px">
          <legend>错误日志</legend>
          <div v-for="o in 4" :key="o" class="text item">
            {{'错误列表内容 ' + o }}
          </div>
          <!--</el-card>-->
        </fieldset>
      </div>
    </div>
    </div>
  </div>
</template>
<script>
   import Card from '../NavBasicManagerment/Card.vue'
    export default {
        name: '',
        components: {
          'v-card': Card,
        },
        data () {
            return {
              pageTitle: '人员导入',
              rizhi:[''],
            }
        },
        methods: {

            //导入文件
          daoru(){

          }
         /* importfxx(obj) {
            let _this = this;
            // 通过DOM取文件数据
            this.file = event.currentTarget.files[0];
            var rABS = false; //是否将文件读取为二进制字符串
            var f = this.file;
            var suffix = f.name.substring(f.name.lastIndexOf('.'));
            if (suffix == '.xlsx') {
              var reader = new FileReader();
              //if (!FileReader.prototype.readAsBinaryString) {
              FileReader.prototype.readAsBinaryString = function (f) {
                var binary = "";
                var rABS = false; //是否将文件读取为二进制字符串
                var wb; //读取完成的数据
                var outdata;
                var reader = new FileReader();
                reader.onload = function (e) {
                  var bytes = new Uint8Array(reader.result);
                  var length = bytes.byteLength;
                  for (var i = 0; i < length; i++) {
                    binary += String.fromCharCode(bytes[i]);
                  }
                  var XLSX = require('xlsx');
                  if (rABS) {
                    wb = XLSX.read(btoa(fixdata(binary)), { //手动转化
                      type: 'base64'
                    });
                  } else {
                    wb = XLSX.read(binary, {
                      type: 'binary'
                    });
                  }
                  outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);//outdata就是你想要的东西
                  for (var i = 0; i < outdata.length; i++) {
                    _this.ziliao=outdata[i];
                    /!*  if (outdata[i]["性别"] == '男') {
                     _this.userForm.tasex = '1';
                     } else {
                     _this.userForm.tasex = '0';
                     }*!/

                    _this.addPostadd5(_this.ziliao);

                  }
                  _this.$message({
                    message: '请耐心等待导入成功',
                    type: 'success'
                  });
                }
                reader.readAsArrayBuffer(f);
              }
              if (rABS) {
                reader.readAsArrayBuffer(f);

              } else {
                reader.readAsBinaryString(f);
              }
            } else {
              _this.$message({
                message: '上传文件格式错误，请上传Excel(.xlsx)文件！',
                type: 'success'
              });
            }
          },
          /!*导入*!/
          addPostadd5: function (ziliao) {
            var _this = this;
            this.$http.post(
              this.$BASE_URL + 'user/add',
              {"params": ziliao}, {emulateJSON: false}).then(function (res) {
              if (res.body > 0) {
                _this.$message.success('导入成功！');
              } else {
                _this.$message.error('导入失败！');
              }
            }, function (res) {
              console.log(res.status);
            });
          },*/
        }
    }
</script>
<style lang="postcss" scoped>
    .lastdiv{
      background-color: #fffcfa;
      padding-bottom: 10px;
    }
    .firstdiv{
      width:100%;
      height:100%;
      background: #fffcfa;
    }
    .left-title{
      text-align: left;
      padding: 10PX 20PX;
    }
    .title-line{
      height:1px;
      width: 98%;
      margin: auto 1%;
      background-color: #ddd;
    }
    .buttonArr{
      width:98%;
      margin:10px 1%;
    }
  .buttonArr a{
    margin-right: 20px;
  }

</style>
